<!DOCTYPE html>       
<!--
==========================================================================
云捷GO自动生成修改页面代码,只生成一次,按需修改.
生成日期：2021-07-09 11:02:15
生成路径: template/module/category/edit.html
生成人：gfcms
==========================================================================
-->
<html lang="zh">
<head>
    {{template "header" (ossUrl)}}
    <link href="/resource//ajax/libs/datapicker/bootstrap-datetimepicker.min.css" rel="stylesheet"/>
    <link href="/resource//ajax/libs/jasny/jasny-bootstrap.min.css" rel="stylesheet"/>
</head>

<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-category-edit" method= "post" enctype="multipart/form-data">
        <input name="Id" value="{{.category.Id}}" type="hidden">
        <input id="treeId" name="parent_id" type="hidden" value="{{.menu.Id}}"/>
            <div class="form-group">
                <label class="col-sm-2 control-label ">上级菜单：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input class="form-control" type="text" onclick="selectMenuTree()" id="treeName" readonly="true"
                               value="{{.menu.Catname}}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            
            <div class="form-group">
                <label class="col-sm-2 control-label">栏目名称：</label>
                <div class="col-sm-8">
                    <input name="catname" value="{{.category.Catname}}" class="form-control"  type="text" required>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">栏目图片：</label>
                <div class="col-sm-8 fileinput fileinput-new input-group" style="padding-right: 15px;padding-left: 15px;"
                     data-provides="fileinput">
                    <div class="form-control" data-trigger="fileinput">
                        <i class="glyphicon glyphicon-file fileinput-exists"></i>
                        <span class="fileinput-filename">{{.category.Image}}</span>
                    </div>
                    <input type="hidden" name="oldimage" value="{{.category.Image}}">
                    <span class="input-group-addon btn btn-white btn-file">
                        <span class="fileinput-new">选择文件</span>
                        <span class="fileinput-exists">更改</span>
                        <input type="file" name="image">
                    </span>
                    <a href="#" class="input-group-addon btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a>
                </div>
            </div>
            
            <div class="form-group">
                <label class="col-sm-2 control-label">描述：</label>
                <div class="col-sm-8">
                    <textarea name="description" class="form-control" >{{.category.Description}}</textarea>
                </div>
            </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">列表页模板：</label>
            <div class="col-sm-8">
                <select class="form-control" name="list_template">
                    <option value="">--请选择模板--</option>
                    {{range $key, $value := .files}}
                        <option value="{{$value.Filename}}" {{if eq $.category.ListTemplate $value.Filename}} selected {{end}} >{{$value.Filename}}</option>
                    {{end}}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">内容页模板：</label>
            <div class="col-sm-8">
                <select class="form-control" name="show_template">
                    <option value="">--请选择模板--</option>
                    {{range $key, $value := .files}}
                        <option value="{{$value.Filename}}" {{if eq $.category.ShowTemplate $value.Filename}} selected {{end}}>{{$value.Filename}}</option>
                    {{end}}
                </select>
            </div>
        </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">排序：</label>
                <div class="col-sm-8">
                    <input name="listorder" value="{{.category.Listorder}}" class="form-control"  type="text" >
                </div>
            </div>
              
            <div class="form-group">
                <label class="col-sm-2 control-label">导航栏显示：</label>
                <div class="col-sm-8">
                    {{getDictTypeRadio "cate_show_hide" "ismenu" .category.Ismenu}}
                </div>
            </div>  
              
    </form>
</div>
{{template "footer" (ossUrl)}}
<script src="/resource/ajax/libs/datapicker/bootstrap-datetimepicker.min.js"></script>
<script src="/resource/ajax/libs/jasny/jasny-bootstrap.min.js"></script>
<script type="text/javascript">
    var prefix = ctx + "module/category";
    $("#form-category-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            var form =new FormData($("#form-category-edit")[0]);

            $.operate.uploadsave(prefix + "/edit", form);
        }
    }
    /*菜单管理-新增-选择菜单树*/
    function selectMenuTree() {
        var treeId = $("#treeId").val();
        var menuId = treeId > 0 ? treeId : 0;
        var url = prefix + "/selectMenuTree?menuId=" + menuId;
        var options = {
            title: '菜单选择',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero) {
        var body = layer.getChildFrame('body', index);
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        layer.close(index);
    }
                                                        
    
</script>
</body>
</html>